<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="javascript" type="text/javascript" src="<%=path%>/My97DatePicker/WdatePicker.js"></script>
<script language="javascript" type="text/javascript" src="<%=path%>/js/jquery-1.9.1.min.js"/></script>
<script>
	function chooseCar(){
		var res=window.showModalDialog('<%=basePath%>/manage/inputmessage/inputmessage_car_show.jsp',window,'dialogWidth:650px;dialogHeight:425px;status:no;directories:yes;scrollbars:no;help=no;');
		if(res!=undefined){
			$('#carInformitionName').val(res.split(',')[0]);
			$('#carInformitionId').val(res.split(',')[1]);
		}
	}
	function admintree(){
		var res=window.showModalDialog('<%=basePath%>/tree.jsp',window,'dialogWidth:300px;dialogHeight:500px;status:no;directories:yes;scrollbars:no;help=no;');
		if(res!=undefined){
			var adminshow=res.split('&')[0]
			var ids=res.split('&')[1].split(',');
			document.getElementById('adminshow').value=adminshow;
			document.getElementById('squadron').value=ids[0];
	        document.getElementById('town').value=ids[1];
	        document.getElementById('village').value=ids[2];
	        document.getElementById('smallvillage').value=ids[3];
        }
	}
	function check(){
		if($('#username').val()==''){
			alert('请输入姓名')
			return false;
		}else if($('#idcard').val()==''){
			alert('请输入身份证号')
			return false;
		}else if($('#mobilephone').val()==''&&$('#telephone').val()==''){
			alert('请输入所绑定用户的手机号或者固定电话号')
			return false;
		}else if($('#adminshow').val()==''){
			alert('请选择所绑定用户的行政管辖')
			return false;
		}
		return true;
	}
	$(function(){
		$('#searchbutton').click(function(){
			var username=$('#searchusername').val();
			var idcard=$('#searchidcard').val();
			if(username!=''&&idcard!=''){
				$.post(
					"<%=path%>/ajax/findOwner.action", 
					{
						username: username,
						idcard: idcard
					},
					function(json){
						var obj = $.parseJSON(json);
						var ownerid=obj.ownerId;
						if(ownerid!=''){
							$('#owerId').val(ownerid);
							$('#username').val(obj.ownerInformitionVo.name);
							$('#idcard').val(obj.ownerInformitionVo.idcard);
							$('#telephone').val(obj.ownerInformitionVo.telephone);
							$('#mobilephone').val(obj.ownerInformitionVo.mobilephone);
							//$('#iissuenum').val(obj.ownerInformitionVo.iissuenum);
							//$('#issuetime').val(obj.ownerInformitionVo.issuetime);
							$('#sourcemode').val(obj.ownerInformitionVo.sourcemode);
							$('#address').val(obj.ownerInformitionVo.address);
							$('#adminshow').val(obj.adminshow);
						}else{
							alert('您查询的行驶证信息不存在');
						}
					},"text"
				);
			}else{
				alert('请输入姓名和身份证号');
			}
		});
		
		$('#sourcemode').prepend("<option value=''>===请选择===</option>");
		$.post(
			"<%=path%>/ajax/findDicByType.action", 
			{
				dicType: 'DIC_SOURCEMODE'
			},
			function(json){
				var obj = $.parseJSON(json);
				$.each(obj.dicList,function(commentIndex, comment) {
					var dictype=comment.dictype;
					$('#sourcemode').append("<option value='"+comment.dicvalue+"'>"+comment.dicname+"</option>");
				})
			},"text"
		);
	});
	var msg="${requestScope.rMsg}";
	if(msg!=""){
		alert(msg);
	}
</script>
<title>Insert title here</title>
<link href="<%=basePath%>/images/css.css" rel="stylesheet" type="text/css">
</head>
<body class="bg_003">
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="201" height="30" align="center" background="<%=basePath%>/images/016.jpg"><table width="75%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="25"><img src="<%=basePath%>/images/1.png" width="16" height="16"></td>
        <td><strong>车辆所有人捆绑录入</strong></td>
      </tr>
    </table></td>
    <td align="right" background="<%=basePath%>/images/017.jpg" class="zi_006">车辆所有人捆绑录入</td>
    <td width="39"><img src="<%=basePath%>/images/018.jpg" width="39" height="30"></td>
  </tr>
</table>
<form id="addForm" name="addForm" action="<%=path %>/messagecollection/addOwnerInformition.action" method="post">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="1" bgcolor="#e1e1e2"></td>
        <td height="298" align="center"><table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#e1e1e1">
          <tr>
            <td width="15%" height="31" align="right" bgcolor="#f5f5f5">已有信息查询：</td>
            <td width="85%" height="31" bgcolor="#f5f5f5" colspan="5" align="left">
            	姓名：<input name="searchusername" type="text" id="searchusername" size="14" >
            	身份证号：<input name="searchidcard" type="text" id="searchidcard" size="30" >
            <input type="button" name="searchbutton" id="searchbutton" value="查询">
            </td>
          </tr>
          <tr>
            <td width="15%" height="31" align="right" bgcolor="#f5f5f5">车辆信息：</td>
            <td width="85%" height="31" bgcolor="#f5f5f5" colspan="5" align="left">
            <input name="carInformitionName" type="text" id="carInformitionName" size="14" >
            <input name="carinformitionVo.id" type="hidden" id="carInformitionId" >
            <input type="button" name="but1" id="but1" value="选择" onclick='chooseCar()'>
            </td>
          </tr>
          <tr>
            <td width="15%" height="31" align="right" bgcolor="#f5f5f5"><font color='red'>*</font>姓名：</td>
            <td width="35%" height="31" align="left" bgcolor="#f5f5f5">
            	<input name="ownerInformitionVo.name" type="text" id="username" size="14">
            </td>
            <td width="15%" height="31" align="right" bgcolor="#f5f5f5"><font color='red'>*</font>身份证号：</td>
            <td width="35%" height="31" align="left" bgcolor="#f5f5f5">
            	<input name="ownerInformitionVo.idcard" type="text" id="idcard" size="30">
            </td>
          </tr>
          <tr>
            <td width="15%" height="31" align="right" bgcolor="#f5f5f5"><font color='red'>*</font>移动电话：</td>
           	<td width="35%" height="31" align="left" bgcolor="#f5f5f5">
           		<input name="ownerInformitionVo.mobilephone" type="text" id="mobilephone" size="14">
           	</td>
            <td width="15%" height="31" align="right" bgcolor="#f5f5f5">固定电话：</td>
            <td width="35%" height="31" align="left" bgcolor="#f5f5f5">
           		<input name="ownerInformitionVo.telephone" type="text" id="telephone" size="14">
           	</td>
          </tr>
          <tr>
            <td width="15%" height="31" align="right" bgcolor="#f5f5f5">车辆获取方式：</td>
            <td width="35%" height="31" align="left" bgcolor="#f5f5f5">
            	<select name="ownerInformitionVo.sourcemode" id="sourcemode"></select></td>
            <td width="15%" height="31" align="right" bgcolor="#f5f5f5">居住地：</td>
            <td width="35%" height="31" align="left" bgcolor="#f5f5f5">
            	<input name="ownerInformitionVo.address" type="text" id="address" size="30">
            </td>
          </tr>
          <tr>
          	<td width="15%" height="31" align="right" bgcolor="#f5f5f5"><font color='red'>*</font>行政管辖：</td>
            <td width="35%" height="31" align="left" bgcolor="#f5f5f5">
            	<input name="adminshow" type="text" id="adminshow" size="30">
            	<input name="ownerInformitionVo.squadron" type="hidden" id="squadron">
            	<input name="ownerInformitionVo.town" type="hidden" id="town">
            	<input name="ownerInformitionVo.village" type="hidden" id="village">
            	<input name="ownerInformitionVo.smallvillage" type="hidden" id="smallvillage">
            	<input type="button" name="but2" id="but2" value="选择" onclick='admintree()'></td>
            <td width="50%" height="31" align="right" bgcolor="#f5f5f5" colspan="2"></td>
          </tr>
        </table>
          <table width="95%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="50" align="center">
              <input name="ownerInformitionVo.id" type="hidden" id="owerId">
              <input type="submit" name="button" id="button" value=" 提 交 " onclick="return check();"></td>
            </tr>
          </table></td>
        <td width="1" bgcolor="#e1e1e2"></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="5" height="5"><img src="<%=basePath%>/images/019.jpg" width="5" height="5"></td>
        <td width="100%" height="5" class="bg_002"></td>
        <td width="5" height="5"><img src="<%=basePath%>/images/020.jpg" width="5" height="5"></td>
      </tr>
    </table></td>
  </tr>
</table>
</form>
<table width="603" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="26">&nbsp;</td>
  </tr>
</table>
</body>

</html>